<?php require_once 'include/prepend.php';?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<h1><img src="images/type_mea.png" align="absmiddle" />Gestion des types de Mise en avant </h1>
<pre>
<font color="#112233">
<?php
  ob_start();
##  *** put a primary key on the first place 
  $sql=" SELECT 							"  
 	   ."type_mise_en_avant.id_type_mea	, 	"
   	   ."type_mise_en_avant.libelle 	,  	"
   	   ."type_mise_en_avant.tarif		,   "
   	   ."type_mise_en_avant.active		  	"
	   ."FROM type_mise_en_avant			";
   
##  *** set needed options
  $debug_mode 		= false;
  $messaging 		= true;
  $unique_prefix 	= "f_";  
  $dgrid 			= new DataGrid($debug_mode, $messaging, $unique_prefix, DATAGRID_DIR);

##  *** allow mulirow operations
 $multirow_option = true;
 $dgrid->allowMultirowOperations($multirow_option);
 $multirow_operations = array(
    "delete"  => array("view"=>true),
    "details" => array("view"=>true)
 );
 $dgrid->setMultirowOperations($multirow_operations);  
  	##  *** set other datagrid/s unique prefixes (if you use few datagrids on one page)
	##  *** format (in wich mode to allow processing of another datagrids)
	##  *** array("unique_prefix"=>array("view"=>true|false, "edit"=>true|false, "details"=>true|false));
 $anotherDatagrids = array("fp_"=>array("view"=>false, "edit"=>true, "details"=>false));
 $dgrid->setAnotherDatagrids($anotherDatagrids); 
 
 
  $dg_encoding 		= "utf-8";
  $dg_collation 	= "utf8_unicode_ci";
  $dgrid->SetEncoding($dg_encoding, $dg_collation);
  $dgrid->SetInterfaceLang("fr");
  ##  *** set exporting option: true(default) or false 
  $exporting_option = true;
  $dgrid->allowExporting($exporting_option);
##  *** set paging settings
 $bottom_paging 	= array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
 $top_paging 		= array("results"=>true, "results_align"=>"left", "pages"=>true, "pages_align"=>"center", "page_size"=>true, "page_size_align"=>"right");
 $pages_array 		= array("10"=>"10", "25"=>"25", "50"=>"50", "100"=>"100", "250"=>"250", "500"=>"500", "1000"=>"1000");
 $default_page_size = 10;
 $paging_arrows 	= array("first"=>"|&lt;&lt;", "previous"=>"&lt;&lt;", "next"=>"&gt;&gt;", "last"=>"&gt;&gt;|");
 $dgrid->SetPagingSettings($bottom_paging, $top_paging, $pages_array, $default_page_size, $paging_arrows);
##  *** set data source with needed options
  $default_order_field = "id_type_mea";
  $default_order_type  = "ASC";
  $dgrid->dataSource($db_conn, $sql, $default_order_field, $default_order_type);	    

## +---------------------------------------------------------------------------+
## | 6. View Mode Settings:                                                    | 
## +---------------------------------------------------------------------------+
##  *** set columns in view mode
   $dgrid->setAutoColumnsInViewMode(true);  

## +---------------------------------------------------------------------------+
## | 7. Add/Edit/Details Mode settings:                                        | 
## +---------------------------------------------------------------------------+
##  ***  set settings for edit/details mode
  $table_name = "type_mise_en_avant";
  $primary_key = "id_type_mea";
  $condition = "";

  
     $em_columns = array(

        "libelle"       =>array("header"=>"Libelle",       "type"=>"textbox",  "width"=>"140px", "req_type"=>"rt", "title"=>"Libelle"),
        "tarif" =>array("header"=>"Tarifs", "type"=>"decimal",     "width"=>"80px", "req_type"=>"rt", "title"=>"Tarif"),
        "active"     =>array("header"=>"Active",     "type"=>"enum",     "req_type"=>"st", "width"=>"210px", "title"=>"Status", "readonly"=>false, "maxlength"=>"-1", "default"=>"", "unique"=>false, "unique_condition"=>"", "on_js_event"=>"", "source"=>"self", "view_type"=>"dropdownlist")
     );
  $dgrid->setColumnsInEditMode($em_columns);

  $dgrid->setTableEdit($table_name, $primary_key, $condition);
  //$dgrid->setAutoColumnsInEditMode(false);
  ##
##
## +---------------------------------------------------------------------------+
## | 5. Filter Settings:                                                       | 
## +---------------------------------------------------------------------------+
##  *** set filtering option: true or false(default)
 $filtering_option = false;
 $dgrid->allowFiltering($filtering_option);
##  *** set aditional filtering settings
  $filtering_fields = array(
    "Type de MEA"     =>array("table"=>"type_mise_en_avant", "field"=>"libelle", "source"=>"self", "operator"=>true, "default_operator"=>"like", "type"=>"textbox", "case_sensitive"=>false,  "comparison_type"=>"string")
  );
  $dgrid->setFieldsFiltering($filtering_fields);
## +---------------------------------------------------------------------------+
## | 8. Bind the DataGrid:                                                     | 
## +---------------------------------------------------------------------------+
##  *** set debug mode & messaging options
    $dgrid->bind();        
    ob_end_flush();

?>
</font>
</pre>
</body>
</html>